export default {
  install(Vue, options) {
    Vue.prototype.readerHd900 = options => {
      return new Promise((resolve, reject) => {
        try {
          if (global.readerHd900) {
            resolve(global.readerHd900)
          } else {
            const $object = document.createElement('object')
            $object.setAttribute('id', 'HD900')
            $object.setAttribute(
              'classid',
              'clsid:347E4A69-DF63-4414-9BC8-BC6E2626F024'
            )
            $object.setAttribute('width', '0')
            $object.setAttribute('height', '0')
            global.document.body.appendChild($object)
            global.readerHd900 = document.getElementById('HD900')
            resolve(global.readerHd900)
          }
        } catch (e) {
          reject(e)
        }
      })
    }
  }
}
